import 'package:demo/common/data/login_data.dart';
import 'package:demo/common/net/data/http_response_data.dart';
import 'package:demo/common/net/http_util.dart';
import 'package:dio/dio.dart';
import 'package:get/get.dart';

/// 接口写这里
mixin ApiMixin on GetxController {
  final CancelToken cancelToken = CancelToken();

  @override
  void onClose() {
    cancelToken.cancel("onClose 请求取消");
    super.onClose();
  }

  Future<LoginData> loginGuest() async {
    Map<String, dynamic> params = {
      // todo 补充参数
    };
    HttpResponseData? data = await HttpUtil().post(
      url: "/mobile.login/guest",
      params: params,
      cancelToken: cancelToken,
    );
    return LoginData.fromJson(data?.jieguo);
  }
}
